package com.hmall.gateway.filters;

import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;

/**
 * @author Administrator
 * @version 1.0
 * @date 2024/6/5 16:39
 */
@Order(2)
@Component
public class PrintAnyGlobalFilter implements GlobalFilter/*, Ordered*/ {
    @Override
    public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
        System.out.println("PrintAny 全局过滤器执行了...");
        return chain.filter(exchange);
    }

    /**
     * 定义当前过滤器的执行优先级，值越小，越优先执行
     * @return
     */
    /*@Override
    public int getOrder() {
        return 2;
    }*/
}
